﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace DataLibrary
{
   public  class Ctbl_YKienKhachHang:IData<tbl_YKienKhachHang>
    {
       public Ctbl_YKienKhachHang(String myconnecString) : base(myconnecString) { }

       protected override int InsertOnSubmit(tbl_YKienKhachHang item, int t)
       {
           throw new NotImplementedException();
       }

       public override List<tbl_YKienKhachHang> GetAll(tbl_YKienKhachHang item)
       {
           throw new NotImplementedException();
       }

       public override tbl_YKienKhachHang GetItemById(object id)
       {
           return GetAll().SingleOrDefault(p => p.IDRow == Convert.ToInt32(id));
       }

       public override tbl_YKienKhachHang GetItem(IDataReader dr)
       {
           tbl_YKienKhachHang obj = new tbl_YKienKhachHang();
           obj.ChucVu = dr[tbl_YKienKhachHang.c_ChucVu].ToString();
           obj.CongTy = dr[tbl_YKienKhachHang.c_CongTy].ToString();
           obj.Hinh = dr[tbl_YKienKhachHang.c_Hinh].ToString();
           obj.HoVaTen = dr[tbl_YKienKhachHang.c_HoVaTen].ToString();
           obj.NoiDung = dr[tbl_YKienKhachHang.c_NoiDung].ToString();
           obj.IDRow =Convert.ToInt32(dr[tbl_YKienKhachHang.c_IDRow]);
           obj.IsActive = Convert.ToInt32(dr[tbl_YKienKhachHang.c_isActive]);
           obj.OrderId= Convert.ToInt32(dr[tbl_YKienKhachHang.c_orderId]);
           return obj;
       }

       public override List<tbl_YKienKhachHang> GetAll()
       {
           return GetAll(strSelect+tbl_YKienKhachHang.b_tbl_YKienKhachHang+strAsc,CommandType.Text);
       }
    }
}
